gh-98354: Add unicode check for 'name' attribute in _imp_create_builtin#98412
gh-98354: Add unicode check for 'name' attribute in _imp_create_builtin#98412miss-islington merged 7 commits intopython:mainfrom chgnrdv:_imp_create_builtin-check-name-for-unicode
Conversation
_imp_create_builtin crashes if 'name' attribute of 'spec' argument is not a 'str' instance. This commit adds appropriate check.
…github.com/chgnrdv/cpython into _imp_create_builtin-check-name-for-unicode
JelleZijlstra
left a comment
There was a problem hiding this comment.
Thanks for contributing a fix!
Agree that this needs a new test. Also, there should be a NEWS entry.
Your check currently still allows subclasses of str. That's probably fine, but worth an additional test.
|
The fix looks good but I agree a test and NEWS entry are warranted. We'll also want to backport the fix to 3.10 and 3.11. |
* main: (40 commits) pythongh-98461: Fix source location in comprehensions bytecode (pythonGH-98464) pythongh-98421: Clean Up PyObject_Print (pythonGH-98422) pythongh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (pythonGH-98462) CODEOWNERS: Become a typing code owner (python#98480) [doc] Improve logging cookbook example. (pythonGH-98481) Add more tkinter.Canvas tests (pythonGH-98475) pythongh-95023: Added os.setns and os.unshare functions (python#95046) pythonGH-98363: Presize the list for batched() (pythonGH-98419) pythongh-98374: Suppress ImportError for invalid query for help() command. (pythongh-98450) typing tests: `_overload_dummy` raises `NotImplementedError`, not `RuntimeError` (python#98351) pythongh-98354: Add unicode check for 'name' attribute in _imp_create_builtin (pythonGH-98412) pythongh-98257: Make _PyEval_SetTrace() reentrant (python#98258) pythongh-98414: py.exe launcher does not use defaults for -V:company/ option (pythonGH-98460) pythongh-98417: Store int_max_str_digits on the Interpreter State (pythonGH-98418) Doc: Remove title text from internal links (python#98409) [doc] Refresh the venv introduction documentation, and correct the statement about VIRTUAL_ENV (pythonGH-98350) Docs: Bump sphinx-lint and fix unbalanced inline literal markup (python#98441) pythongh-92886: Replace assertion statements in `handlers.BaseHandler` to support running with optimizations (`-O`) (pythonGH-93231) pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `_test_multiprocessing.py` (pythonGH-93233) pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `test_py_compile.py` (pythonGH-93235) ...
|
@ericsnowcurrently @sweeneyde |
|
Thanks for bringing this up, @chgnrdv!
CI would have caught this if it's a consistent problem. Is this intermittent (depending on the order of tests?
It shouldn't be crashing though. Furthermore, if you are still seeing the behavior from gh-98354 in some cases then we should fix it. I've re-opened the issue. |
It can depend on the order of tests, since it crashes when I run the test package in default order, but passes the CI (which, AFAIK, runs tests in random order).
I don't see the behaviour which I had to fix by this PR anymore and I'm sure that this issue or my fix itself can't cause any problem like this. I think that it is somehow related to how test package handles the import of Test package output with traceback and abort message: Stack trace: |
|
@ericsnowcurrently |
Fixes #98354
Automerge-Triggered-By: GH:ericsnowcurrently